using System;
using System.Text;

namespace Domain.Misc
{
    public static class RandomStringGenerator
    {
        public static string Generate(int size)
        {
            StringBuilder sb = new StringBuilder();
            Random r = new Random();

            for (int i = 1; i <= size; i++)
            {
                switch (r.Next(1, 4))
                {
                    case 1: // number
                        sb.Append(Convert.ToChar(r.Next(48, 58)));
                        break;
                    case 2: // capital letter
                        sb.Append(Convert.ToChar(r.Next(65, 91)));
                        break;
                    case 3: // non capital letter
                        sb.Append(Convert.ToChar(r.Next(97, 123)));
                        break;
                }
            }

            return sb.ToString();
        }
    }
}
